﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Login</title>
    <!-- CSS -->
    <link rel="stylesheet" type="text/css" href="../../Scripts/plugins/jquery-ui-1.8.6/css/custom-theme/jquery-ui-1.8.6.custom.css" />    
    <link rel="stylesheet" type="text/css" href="../../Content/Site.css" />
    <link rel="stylesheet" type="text/css" href="../../Content/Form.css" />
    <style type="text/css">
        .warning {
            color: Red;
            margin-left: 26px;
            display: none;
        }
    </style>
    <!-- Default JS-->
    <script type="text/javascript" src="../../Scripts/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="../../Scripts/plugins/jquery-ui-1.8.6/js/jquery-ui-1.8.6.custom.min.js"></script>
    <script type="text/javascript" src="../../Scripts/Default.js"></script>
    <script type="text/javascript" src="../../Scripts/Extension.js"></script>
    <script type="text/javascript" src="../../Scripts/Plugins/jquery-validate/jquery.validate.min.js"></script>
    <!-- Custom JS-->
    <script type="text/javascript">
        $.validator.setDefaults({
            highlight: function (input) {
                $(input).addClass("ui-state-error");
            },
            unhighlight: function (input) {
                $(input).removeClass("ui-state-error");
            }
        });
        $(document).ready(function () {
            var form = $('<div id="__form">');
            form.appendTo('body').load('/Acesso/Form', null, function () {
                form.dialog({
                    modal: true,
                    resizable: false,
                    draggable: false,
                    closeOnEscape: false,
                    title: 'Login',
                    width: 'auto',
                    height: 'auto',
                    open: function () {
                        $('#NOME_USUARIO').focus();
                        loadInputs();
                        ButtonTheme();
                        $(".ui-dialog-titlebar").hide();
                        $('#NOME_USUARIO, #SENHA_USUARIO').focus(function () {
                            $('.warning').fadeOut('normal', function () {
                                $(this).text('');
                            });
                        });
                    }
                });
            });
        });

        function validar() {
            progressDialog(true);
            $.getJSON('/Acesso/LoginValidate', $('form').serialize(), function (data) {
                if (data == true)
                    window.location = '/Home/Index';
                else {
                    progressDialog(false);
                    $('.warning').text(data).fadeIn('normal');
                    $('.ui-dialog-titlebar:last').css('display', 'none');
                }
            });
        }

        function esqueceuSenha() {
            if ($('#NOME_USUARIO').val() == '') {
                $('.warning').text('Informe o código de usuário ou email').fadeIn('normal');
            }
        }

        function alterarSenha() {
            if ($('#NOME_USUARIO, #SENHA_USUARIO').val() == '') {
                $('.warning').text('Informe o código de usuário ou email e senha atual').fadeIn('normal');
            }
        }
    </script>
</head>
<body>    
</body>
</html>